/**
 * @param {number[][]} matrix
 * @return {void} Do not return anything, modify matrix in-place instead.
 */
// 先将元素关于主对角线对称，然后关于y轴对称即可
var rotate = function(matrix) {
    let r = matrix.length, c = matrix[0].length
    for(let i = 0; i < r; i++) {
        for(let j = 0; j < i; j++) {
            let temp = matrix[i][j]
            matrix[i][j] = matrix[j][i]
            matrix[j][i] = temp
        }
    }
    let middle = Math.floor(c / 2)
    console.log(matrix);
    for(let i = 0; i < r; i++) {
        for(let j = 0; j < middle; j++) {
            let temp = matrix[i][j]
            matrix[i][j] = matrix[i][c - j - 1]
            matrix[i][c - j - 1] = temp
        }
    }
    return matrix
};